package com.bruan.d2_SimpleDateFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test {
    public static void main(String[] args) throws ParseException {
        Date date = new Date();
        System.out.println(date);

        long time = date.getTime();
        System.out.println(time);

        //格式化日历对象
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EEE a");
        String rs = sdf.format(date);
        String rs1 = sdf.format(time);
        System.out.println(rs);
        System.out.println(rs1);

        System.out.println("----------------------");
        SimpleDateFormat s1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataStr = "2024-02-24 12:12:11";
        Date d1 = s1.parse(dataStr);
        System.out.println(d1);

    }
}
